// pages/fastSend/fastSend.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    current: 1,
    allOrderForm: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    getOrderForm(this, 1)
    this.setData({
      userInfo: wx.getStorageSync("userInfo"),
      imageUrl: app.globalData.imageUrl
    })
    wx.getSystemInfo({//获取滑块的高宽
      success: function (res) {
        that.setData({
          winWidth: res.windowWidth,
          winHeight: res.windowHeight
        });
      }
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },
  callAvatar: function (e) {
    wx.makePhoneCall({
      phoneNumber: '' + e.target.id,
    })
  },


  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  switchTab: function (e) {
    this.setData({
      current: e.target.id
    })
  }
})


function getOrderForm(that, _id) {
  console.log(wx.getStorageSync('userType'));
  if (wx.getStorageSync('userType') <= 0) {
    wx.showToast({
      title: '请先成为庄主',
      icon: 'loading',
      duration: 4000
    });
    return false;
  } else {
    wx.request({
      url: app.globalData.allUrl + "/orderFormAction/getOrderFormByStatusAndType",
      data: {
        //  userid: parseInt(wx.getStorageSync('userid')),//用户唯一ID
        status: _id,//订单状态ID（1-5）,
        typeId: 2,
        superId: wx.getStorageSync("agentId"),
      },
      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      // header: {}, // 设置请求的 header
      success: function (res) {
        console.log(res.data);
        if (!res.data || res.data.length > 200) {
          return
        }
        that.setData({
          allOrderForm: res.data,
        })
      }
    })
  }

}